/*
*
==============================================================================
*  Name        : 
*  Part of     : Omen Game Engine
*  Description : 
*  Version     : 1.0
*
*  Copyright (c) 2013 Lauri Kortevaara.
* 
==============================================================================
*/

#pragma once

#ifndef Omen_PROPERTY_H
#define Omen_PROPERTY_H

/// Omen Headers
#include "OmenConfig.h"

/// STL Headers
#include <string>
#include <sstream>

namespace Omen {
    
        class Property
        {
        public:
            Property() {};
            Property( const std::wstring propertyName, const std::wstring& propertyValue ) { m_name = propertyName; m_value = propertyValue; }
            Property( const Property& other ) { this->m_value = other.m_value; }

            Property( const std::wstring& strValue ) { m_value = strValue;  }
            Property( const bool& bValue ) { std::wstringstream sstream(m_value); sstream << bValue;   }
            Property( const int& intValue ) { std::wstringstream sstream(m_value); sstream << intValue;   }
            Property( const unsigned int& uintValue ) { std::wstringstream sstream(m_value); sstream << uintValue;   }
            Property( const double& dblValue ) { std::wstringstream sstream(m_value); sstream << dblValue;   }
            Property( const float& floatValue ) { std::wstringstream sstream(m_value); sstream << floatValue;   }

            operator std::wstring() const { return m_value; }
            operator bool() const  { std::wstringstream sstream(m_value); bool bValue; bValue = m_value == L"true"; return bValue; }
            operator int() const { std::wstringstream sstream(m_value); int intValue; sstream >> intValue; return intValue; } 
            operator unsigned int() const { std::wstringstream sstream(m_value); unsigned int uintValue; sstream >> uintValue; return uintValue; } 
            operator double() const { std::wstringstream sstream(m_value); double dblValue; sstream >> dblValue; return dblValue; } 
            operator float() const { std::wstringstream sstream(m_value); float floatValue; sstream >> floatValue; return floatValue; } 

            Property& operator=( const std::wstring& strValue ) { m_value = strValue; return *this; }
            Property& operator=( const bool& bValue ) { std::wstringstream sstream(m_value); sstream << bValue;  return *this; }
            Property& operator=( const int& intValue ) { std::wstringstream sstream(m_value); sstream << intValue;  return *this; }
            Property& operator=( const unsigned int& uintValue ) { std::wstringstream sstream(m_value); sstream << uintValue;  return *this; }
            Property& operator=( const double& dblValue ) { std::wstringstream sstream(m_value); sstream << dblValue;  return *this; }
            Property& operator=( const float& floatValue ) { std::wstringstream sstream(m_value); sstream << floatValue;  return *this; }

            /*const Property& operator=( const std::wstring& strValue ) { m_value = strValue; return *this; }
            const Property& operator=( const bool& bValue ) { std::wstringstream sstream(m_value); sstream << bValue;  return *this; }
            const Property& operator=( const int& intValue ) { std::wstringstream sstream(m_value); sstream << intValue;  return *this; }
            const Property& operator=( const unsigned int& uintValue ) { std::wstringstream sstream(m_value); sstream << uintValue;  return *this; }
            const Property& operator=( const double& dblValue ) { std::wstringstream sstream(m_value); sstream << dblValue;  return *this; }
            const Property& operator=( const float& floatValue ) { std::wstringstream sstream(m_value); sstream << floatValue;  return *this; }*/
        private:
            std::wstring m_name;
            std::wstring m_value;
        };

} // namespace Omen ends

#endif // Omen_PROPERTY_H